-
Notifications
You must be signed in to change notification settings - Fork 726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hot region schedule supports store weight #2240
Conversation
Thanks for your contribution. If your PR get merged, you will be rewarded 1294 points. |
/run-all-tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @mantuliu, thanks for your contribution.
Could you do more tests or test it in a real cluster?
server/schedulers/hot_region.go
Outdated
@@ -288,12 +297,17 @@ func summaryStoresLoad( | |||
} | |||
} | |||
|
|||
//calculate the storeWeight | |||
storeWeight := calcStoreWeight( | |||
cluster.GetStore(id).GetRegionWeight(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This weight may need to be separated from the cluster weight, because this is related to load, and the previous weight is more related to size. you can wait for #2239.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.I will do more test and wait for #2239.
server/schedulers/hot_region.go
Outdated
return false | ||
} | ||
} else { | ||
byteRkCmp := rankCmp(bs.cur.srcPeerStat.GetByteRate(), old.srcPeerStat.GetByteRate(), stepRank(0, 100)) | ||
keyRkCmp := rankCmp(bs.cur.srcPeerStat.GetKeyRate(), old.srcPeerStat.GetKeyRate(), stepRank(0, 10)) | ||
byteRkCmp := rankCmp(bs.cur.srcPeerStat.GetByteRate()/storeWeight, old.srcPeerStat.GetByteRate()/oldStoreWeight, stepRank(0, 100)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe do it in stepRank
? compareSrcStore
and compareDstStore
also need it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't implement this in the stepRank method, because stepRank might become something like the following:
func stepRank(rk0 float64, step float64) func(float64) int64 {
return func(rate storeWeight float64) int64 {
return int64((rate/storeWeight - rk0) / step)
}
}
This makes all the methods related to stepRank need to be changed,such as stLdByteRate,stLdKeyRate,sliceLoadCmp,sliceLPCmp. I personally think that such changes will increase the complexity of these functions. But I still tried to optimize this logic and added a getRateWithStoreWeight function.
what do you think?^_^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution, I will take the time to take a look and test.
Codecov Report
@@ Coverage Diff @@
## master #2240 +/- ##
==========================================
+ Coverage 76.25% 76.39% +0.14%
==========================================
Files 199 199
Lines 21591 21722 +131
==========================================
+ Hits 16464 16595 +131
+ Misses 3891 3888 -3
- Partials 1236 1239 +3
Continue to review full report at Codecov.
|
Thank you,I added a new parameter(hot-weight) to measure the ability of the store to handle hot regions. I will test it in an actual cluster. |
Hi, @mantuliu thanks for your contribution. |
@nolouch Thank you. I have joined. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool!
Co-Authored-By: Ryan Leung <[email protected]>
Hi @mantuliu . |
OK,I will resolve the conflict and make a test. |
What problem does this PR solve?
UCP #2168
What is changed and how it works?
Add a method for calculate the storeWeight
byteRate and KeyRate are recalculated using:
Check List
Tests
Unit test
Manual test
Command: sysbench oltp_read_only (table size=10000000, threads=300)
before
after set store 1 hot-weight=1 store 2 hot-weight=1 store 7 hot-weight =2
Side effects